<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>webmanAdmin</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<meta http-equiv="content-type" content="text/html;charset=utf-8">

<!-- layui CSS -->
<link rel="stylesheet" href="/admin/layui/css/layui.css">
<link rel="stylesheet" href="/admin/font/iconfont.css?v=1.0.0" type="text/css" media="all">
<style>
body{
	padding: 15px;
}
.pagination li{float:left}
.page-count{float:left;display:block;padding:0 10px; margin:10px 10px 10px 0; border:1px solid #e2e2e2;line-height:28px;}
.page-footbtn{float:left;display:block;padding:0 10px; margin:10px 10px 10px 0; line-height:30px; color: white;}
.page-footbtn:hover{ color: white;}
.layui-collapse .layui-form .layui-inline{margin:5px 0;}
.layui-table .layui-btn-xs{ margin:5px 2px;}
</style>
</head>

{block name="body"}

{/block}
<script src="/admin/layui/layui.js"></script>
<script>
layui.config({
	base: '/admin/js/',
	version : true,
}).extend({
	layajax: 'layajax'
});

layui.use(['jquery','element','layer','form'], function(){
	var $ = layui.jquery
	,layer = layui.layer
	,element = layui.element
	,form = layui.form;
	
	//表单submit监听
	form.on('submit(*)', function(data){
		var action = $('.layui-form').attr('action');
		var ary = data.field;
		$.ajax({
			url: action,
			data: ary,
			type: "post",
			dataType:'json',
			success:function(res){
				console.log(res);
				//数据处理
				if(res.code==1){
					layer.msg(res.msg, {
						time: 20000,
						btn: ['返回列表', '留在此页'],
						yes: function (index, layero) {
							layer.close(index);
							window.location.href = res.data;
						},
						btn2: function (index, layero) {
							layer.close(index);
						}
					});
				}
				if(res.code==0){
					layer.msg(res.msg, {icon:2,time:1000});
				}
			},error: function(res){
				console.log(res);
				layer.msg('致命错误');
			}
		});
		return false;
	});
	
	//表单search监听
	form.on('submit(search)', function(data){
		$(this).submit();
	});
	
});
</script>
<!--脚本文件开始-->
{block name="script"} {/block}
<!--脚本文件结束-->
</html>
